<header class="page-header clearfix">
    <h4><i class="fa fa-building"></i>构建镜像</h4>
    <div class="toolbox">
        <!-- <a ui-sref="app-image-build"><i class="fa fa-plus"></i>新增构建</a> -->
        <a ng-click="list.openUploadForm()"><i class="fa fa-upload"></i>上传镜像</a>
    </div>
    <ol class="breadcrumb">
        <li><a>镜像管理</a></li>
        <li class="active">构建镜像</li>
    </ol>
</header>
<section>
    <ui-panel class="panel-list">
        <form class="form-inline form-search" ng-submit="list.search()">
            <div class="form-group">
                <input type="text" maxlength="50" ng-model="list.filter.name" class="form-control" placeholder="请输入镜像名称查询"/>
            </div>
            <div class="form-group">
                <input type="text" maxlength="50" ng-model="list.filter.ver" class="form-control" placeholder="请输入镜像版本查询"/>
            </div>
            <div class="form-group">
                <select type="text" ng-model="list.filter.status" class="form-control"
                        ng-options="opt.val as opt.name for opt in ::list.statusList">
                    <option value="">请选择状态</option>
                </select>
            </div>
            <button class="btn btn-default" type="submit">查询</button>
        </form>
        <table class="table table-hover">
            <thead>
            <tr>
                <th width="30%">镜像名称</th>
                <th width="15%">镜像版本</th>
                <th width="15%">状态</th>
                <th width="20%">构建时间</th>
                <th class="text-center" width="10%">查看日志</th>
                <th class="text-center" width="10%">DockerFile</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="elem in list.table">
                <td ng-switch="::elem.buildImageState">
                    <a ng-switch-when="001"
                       ui-sref="docker-image-detail({imageId: elem.dockerImageFileId})">{{::elem.imageName}}</a>
                    <span ng-switch-default>{{::elem.imageName}}</span>
                </td>
                <td>{{::elem.version}}</td>
                <td ng-switch="::elem.buildImageState">
                    <span class="text-success" ng-switch-when="001">
                        <i class="margin-right-5 fa fa-check"/>构建成功
                    </span>
                    <span class="text-danger" ng-switch-when="002">
                        <i class="margin-right-5 fa fa-times"/>构建失败
                    </span>
                    <span class="text-primary" ng-switch-when="000">
                        <i class="margin-right-5 fa fa-cog fa-spin"/>构建中
                    </span>
                </td>
                <td>{{::elem.createTime | date: 'yyyy-MM-d HH:mm:ss'}}</td>
                <td class="text-center"><a href="javascript:void(0)" title="查看构建日志"
                                           ng-click="list.openLogForm(elem)"><i class="fa fa-file-text"></i></a></td>
                <td class="text-center"><a href="javascript:void(0)" title="查看DockerFile"
                                           ng-click="list.openFileForm(elem)"><i class="fa fa-file-text"></i></a></td>
            </tr>
            </tbody>
        </table>
        <!--Loading-->
        <div class="loading" ng-show="!list.table"></div>
        <!--分页-->
        <div ng-show="list.table" class="pagination-group">
            <ui-pagination-info items-per-page="10" items-per-page-select="false"
                                total-items="list.page.totalItems"
                                current-page="list.page.currentPage"></ui-pagination-info>
            <button type="button" ng-click="list.getList()" class="btn btn-default btn-refresh"><i class="fa fa-refresh"></i></button>
            <ui-pagination items-per-page="10" total-items="list.page.totalItems"
                           ng-model="list.page.currentPage" ng-change="list.getList()"></ui-pagination>
        </div>
    </ui-panel>
</section>